var gulp = require('gulp'),
    jshint = require('gulp-jshint'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename'),
    concat = require('gulp-concat'),
    connect = require('gulp-connect');

var rootDir = 'toggling', //'atMe',
    mainjsFile = 'toggling.js'; //'atMe.js';

gulp.task('connect', function() {
    connect.server({
        root: rootDir,
        livereload: true,
        port: 8081
    });
});

gulp.task('html', function() {
    return gulp.src(rootDir + '/index.html')
        .pipe(connect.reload());
});

gulp.task('js', function() {
    return gulp.src(rootDir + '/' + mainjsFile)
        .pipe(connect.reload());
});

gulp.task('css', function() {
    return gulp.src(rootDir + '/index.css')
        .pipe(connect.reload());
});

gulp.task('watch', function() {
    gulp.watch(rootDir + '/index.html', ['html']);
    gulp.watch(rootDir + '/' + mainjsFile, ['js']);
    gulp.watch(rootDir + '/index.css', ['css']);
});

gulp.task('default', ['connect'], function() {
    gulp.start('watch');
});
